import { createPinia } from 'pinia';
import { createSSRApp } from 'vue';
import App from './App.vue';
import { routeInterceptor } from './interceptors/route.interceptor';

import '@/static/iconfont/iconfont.css';
import '@/static/style/index.scss';
import 'virtual:uno.css';

export function createApp() {
  const app = createSSRApp(App);

  // 挂载pinia
  app.use(createPinia());
  app.use(routeInterceptor);
  return {
    app
  };
}

// #ifndef MP
uni.connectSocket = (function (connectSocket) {
  return function (options) {
    options.success = options.success || function () {};
    // eslint-disable-next-line ts/ban-ts-comment
    // @ts-expect-error
    return connectSocket.call(this, options);
  };
})(uni.connectSocket);
// #endif
